﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:v="clr-namespace:Windy.DragonCurve.Views"
        xmlns:local="clr-namespace:Windy.DragonCurve" x:Name="window" x:Class="Windy.DragonCurve.MainWindow"
        xmlns:m="clr-namespace:Windy.DragonCurve"
        mc:Ignorable="d"
        Title="Windy.DragonCurve" Height="350" Width="525">
    <Window.Resources>
    	<v:DoubleToStringValueConverter x:Key="DoubleToStringValueConverter"/>
        <DataTemplate x:Key="DragonCurveSchemeDataTemplate" DataType="{x:Type m:DragonCurveScheme}">
            <Grid>
                <TextBlock Margin="0,0,0,4.04" TextWrapping="Wrap" Text="{Binding Name}" d:LayoutOverrides="Width, Height"/>
            </Grid>
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.297*"/>
            <ColumnDefinition Width="0.703*"/>
        </Grid.ColumnDefinitions>
        <ListBox Margin="8,33.96,9.758,8" ItemsSource="{Binding Schemes, ElementName=window}" ItemTemplate="{DynamicResource DragonCurveSchemeDataTemplate}" HorizontalContentAlignment="Stretch" IsSynchronizedWithCurrentItem="True"/>
        <Label Content="Dragon Curve _Schemes" Margin="8,8,9.758,0" VerticalAlignment="Top" d:LayoutOverrides="Width"/>
        <GridSplitter Width="5" Margin="0,5"/>
        <Slider Grid.Column="1" Margin="8,8,63,0" VerticalAlignment="Top" Value="{Binding StepLength, ElementName=dragonCurveView}" Maximum="100" LargeChange="10" SmallChange="1" Minimum="1"/>

        <v:DragonCurveView x:Name="dragonCurveView" Grid.Column="1" Margin="8,34,30,57.293" BorderThickness="1" BorderBrush="Black" DragonCurveScheme="{Binding Schemes/, ElementName=window}" CurveBrush="#FF1843F1"/>
        <Button Content="Update" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="75" Grid.Column="1" Margin="0,0,96,8" Command="{x:Static v:DragonCurveCommands.UpdateDragonCurveCommand}" CommandTarget="{Binding ElementName=dragonCurveView}" />
        <Button Content="Reset" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="75" Grid.Column="1" Margin="0,0,8,8" Command="{x:Static v:DragonCurveCommands.ResetDragonCurveCommand}" CommandTarget="{Binding ElementName=dragonCurveView}" />
        <TextBox Grid.Column="1" HorizontalAlignment="Right" Margin="0,5,8,0" TextWrapping="Wrap" Text="{Binding StepLength, Converter={StaticResource DoubleToStringValueConverter}, ElementName=dragonCurveView}" VerticalAlignment="Top" Width="55" TextAlignment="Center"/>
        <Slider Grid.Column="1" HorizontalAlignment="Right" Margin="0,37.253,5,61.253" Width="22" Orientation="Vertical" Maximum="{Binding ActualHeight, ElementName=dragonCurveView}" LargeChange="10" SmallChange="1" Value="{Binding StartPointY, ElementName=dragonCurveView}" RenderTransformOrigin="0.5,0.5">
        	<Slider.RenderTransform>
        		<TransformGroup>
        			<ScaleTransform ScaleY="-1" ScaleX="1"/>
        			<SkewTransform AngleY="0" AngleX="0"/>
        			<RotateTransform Angle="0"/>
        			<TranslateTransform/>
        		</TransformGroup>
        	</Slider.RenderTransform>
        </Slider>
        <Slider Grid.Column="1" Height="19.333" Margin="8,0,30,33.96" VerticalAlignment="Bottom" Maximum="{Binding ActualWidth, ElementName=dragonCurveView}" LargeChange="10" SmallChange="1" Value="{Binding StartPointX, ElementName=dragonCurveView}"/>
        <TextBox Grid.Column="1" HorizontalAlignment="Left" Margin="8,0,0,8" TextWrapping="Wrap" Text="{Binding StartPointX, Converter={StaticResource DoubleToStringValueConverter}, ElementName=dragonCurveView}" VerticalAlignment="Bottom" Width="52.666" TextAlignment="Center"/>
        <TextBox Grid.Column="1" HorizontalAlignment="Left" Margin="64.666,0,0,8" TextWrapping="Wrap" Text="{Binding StartPointY, Converter={StaticResource DoubleToStringValueConverter}, ElementName=dragonCurveView}" VerticalAlignment="Bottom" Width="52.666" TextAlignment="Center"/>

    </Grid>
</Window>
